package cn.daniellee.plugin.eb.menu;

import cn.daniellee.plugin.eb.ExcellentBuilding;
import cn.daniellee.plugin.eb.component.ItemGenerator;
import org.bukkit.Bukkit;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryHolder;

public class EditMenu {

	public static Inventory generate() {
		Inventory menu = Bukkit.createInventory(new EditMenuHolder(), InventoryType.HOPPER, ExcellentBuilding.getInstance().getConfig().getString("menu.edit.title", "&6&lEdit building").replace("&", "§"));

		menu.setItem(0, ItemGenerator.getItem(ExcellentBuilding.getInstance().getConfig().getString("menu.edit.button.name.name", "&bModify name"), ExcellentBuilding.getInstance().getConfig().getStringList("menu.edit.button.name.lore"), ExcellentBuilding.getInstance().getConfig().getString("menu.edit.button.name.item.material", "NAME_TAG"), ExcellentBuilding.getInstance().getConfig().getInt("menu.edit.button.name.item.durability", 0)));

		menu.setItem(1, ItemGenerator.getItem(ExcellentBuilding.getInstance().getConfig().getString("menu.edit.button.intro.name", "&bModify introduction"), ExcellentBuilding.getInstance().getConfig().getStringList("menu.edit.button.intro.lore"), ExcellentBuilding.getInstance().getConfig().getString("menu.edit.button.intro.item.material", "WRITABLE_BOOK"), ExcellentBuilding.getInstance().getConfig().getInt("menu.edit.button.intro.item.durability", 0)));

		menu.setItem(2, ItemGenerator.getItem(ExcellentBuilding.getInstance().getConfig().getString("menu.edit.button.location.name", "&bReset teleport point"), ExcellentBuilding.getInstance().getConfig().getStringList("menu.edit.button.location.lore"), ExcellentBuilding.getInstance().getConfig().getString("menu.edit.button.location.item.material", "ENDER_PEARL"), ExcellentBuilding.getInstance().getConfig().getInt("menu.edit.button.location.item.durability", 0)));

		menu.setItem(3, ItemGenerator.getItem(ExcellentBuilding.getInstance().getConfig().getString("menu.edit.button.icon.name", "&bModify icon"), ExcellentBuilding.getInstance().getConfig().getStringList("menu.edit.button.icon.lore"), ExcellentBuilding.getInstance().getConfig().getString("menu.edit.button.icon.item.material", "BEACON"), ExcellentBuilding.getInstance().getConfig().getInt("menu.edit.button.icon.item.durability", 0)));

		menu.setItem(4, ItemGenerator.getItem(ExcellentBuilding.getInstance().getConfig().getString("menu.edit.button.delete.name", "&bDelete building"), ExcellentBuilding.getInstance().getConfig().getStringList("menu.edit.button.delete.lore"), ExcellentBuilding.getInstance().getConfig().getString("menu.edit.button.delete.item.material", "TNT"), ExcellentBuilding.getInstance().getConfig().getInt("menu.edit.button.delete.item.durability", 0)));

		return menu;
	}

	public static class EditMenuHolder implements InventoryHolder {
		@Override
		public Inventory getInventory() {
			return Bukkit.createInventory(null, InventoryType.HOPPER);
		}
	}
}
